{include file="public/header" /}
<body class="bgc">
<div class="header">
    <i class="layui-icon layui-icon-left"></i> 留言反馈
    <a href="{:url('message/record')}" style="position: absolute;right: 1rem;font-size: 12px">反馈记录</a>
</div>
<form action="{:url('message/save')}" method="post" class="form layui-form">
    <input type="hidden" id="images" name="images" value=""/>
    <div class="feedback-content">
        <textarea name="content" placeholder="请输入您要反馈的问题（5-500字以内）"></textarea>
        <div class="feedback-imgs">
            <p>请提供问题的截图或照片（选填）</p>
            <ul class="images">
                <li>
                    <p class="flex-center">
                        <img src="/static/index/img/icon39.png" alt="" id="uploads">
                    </p>
                </li>
            </ul>
        </div>
    </div>
</form>
<div class="save-btn">
    <p class="save" lay-submit lay-filter="save" formObj=".form">提交</p>
</div>
</body>
{include file="public/footer"/}
<script>
    layui.upload.render({
        elem: '#uploads',
        url: '/index/uploads/uploadImage.html',
        before: function (obj) {
            layer.load(2);
            obj.preview(function (index, file, result) {
                $('.images').append('<li>' +
                    '                <p class="flex-center">' +
                    '                    <img src="' + result + '" alt="" id="image_show">' +
                    '                </p>' +
                    '                <img src="/static/index/img/delete.png" alt="" class="delete">' +
                    '            </li>');
            });
        },
        done: function (res) {
            layer.closeAll();
            if (res.code == 200) {
                layer.msg('上传成功');
                $("#images").val(res.data.url);
            } else {
                return layer.msg('上传失败:' + res.msg);
            }

        },
        error: function () {
            return layer.msg('上传失败');
        }
    });
    $(".images").on('click', '.delete', function () {
        $(this).parent().remove();
        $("#images").val('');
    });
</script>
</html>